﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using InstituteManager.Bussiness;
using InstituteManager.Data;

namespace InstituteManager.adm
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Permission"] != null)
                switch (Session["Permission"].ToString())
                {
                    case "0":
                        pnlStudent.Visible = true;
                        break;
                    case "1":
                        pnlAdmin.Visible = true;
                        break;
                    case "2":
                        pnlManager.Visible = true;
                        break;
                    case "3":
                        pnlTeacher.Visible = true;
                        break;
                }

            InstituteManagerEntities InsMana = new InstituteManagerEntities();
            lblAdminstrator.Text = (from sc in InsMana.tbl_Staff where sc.Permission == 1 select sc).Count().ToString();
            lblManager.Text = (from sc in InsMana.tbl_Staff where sc.Permission == 2 select sc).Count().ToString();
            lblTeacher.Text = (from sc in InsMana.tbl_Staff where sc.Permission == 3 select sc).Count().ToString();
            lblStudent.Text = InsMana.tbl_Student.Count().ToString();

            lblPosting.Text = InsMana.tbl_Posting.Count().ToString();
            lblCompetition.Text = InsMana.tbl_Competition.Count().ToString();
            lblExhibition.Text = InsMana.tbl_Exhibition.Count().ToString();
        }
    }
}